﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using LP580.CG;

/// <summary>
///area 的摘要说明
/// </summary>
public class area
{
    public static DataSet GetProvince()
    {
        string sql = "select id,name from [Area_z] where parentID=0";
        return GetDataSet(sql);
    }
    public static DataSet GetCity(int provinceid)
    {
        string sql = "select id,name from [Area_z] where parentID=" + provinceid;
        return GetDataSet(sql);
    }
    public static DataSet GetLimit()
    {
        string sql = "select id,name from [limit_z]";
        return GetDataSet(sql);
    }
    public static DataSet GetDataSet(string sql)
    {
        DBase db = new DBase();
        return db.ExecuteDataSet(sql);
    }
    public static bool DelById(string ids, string tbName)
    {
        return Exec(string.Format("delete from [{1}_z] where id in ({0})", ids, tbName));
    }
    public static string GetAreaName(int id)
    {
        string sql = "select name from [Area_z] where id=" + id.ToString();
        DBase db = new DBase();
        return db.ExecuteScalar(sql).ToString();
    }

    public static bool Exec(string sqlStr)
    {
        DBase dbo = new DBase();
        bool b = dbo.ExecSql(sqlStr);
        dbo.CloseConn();
        dbo = null;
        return b;
    }
}